package lanou.giftsay_01.main.categorymain;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;

import lanou.giftsay_01.R;
import lanou.giftsay_01.adapter.MyLvadapter;
import lanou.giftsay_01.bean.GuideBean;
import lanou.giftsay_01.bean.NormalBean;
import lanou.giftsay_01.tools.BaseActivity;
import lanou.giftsay_01.tools.MyApp;
import lanou.giftsay_01.tools.NetTool;
import lanou.giftsay_01.tools.URLValues;

/**
 * Created by dllo on 16/8/27.
 */
public class NormalActitivty extends BaseActivity {

    private ListView listView;
    private String id;
    private ImageView iv;
    private TextView title;
    private String name;

    @Override
    protected int setLayout() {
        return R.layout.activity_normal;
    }

    @Override
    protected void initView() {
        iv = (ImageView) findViewById(R.id.normal_iv_goback);
        Intent intent = getIntent() ;
        id = intent.getStringExtra("id");
        name = intent.getStringExtra("name");
        title = (TextView) findViewById(R.id.normal_title_tv);
        listView = (ListView) findViewById(R.id.normal_ll);


    }

    @Override
    protected void initDate() {
        title.setText(name);
        iv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        NetTool netTool = new NetTool();
        netTool.getNetData(URLValues.JUMP + id + URLValues.JUMP2, GuideBean.class, new NetTool.NetListener<GuideBean>() {
            @Override
            public void onSuccess(GuideBean guideBean) {
                MyLvadapter myLvadapter = new MyLvadapter(getApplicationContext());
                ArrayList<GuideBean> arrayList = new ArrayList<GuideBean>();
                arrayList.add(guideBean);
                myLvadapter.setArrayList(arrayList);
                listView.setAdapter(myLvadapter);
             }

            @Override
            public void onError(String errorMsg) {

            }
        });
    }
}
